import http from "./request";

async function getSearch(val) {
  let { data } = await http.get(
    "https://elm.cangdu.org/v1/pois?type=search&city_id=32&keyword=" + val
  );
  return data;
}
//根据关键字进行搜索 type固定就是search 城市id city-id固定就是32郑州 val是搜索关键字

async function getList(params) {
  let { data } = await http.get(
    `https://elm.cangdu.org/shopping/restaurants?latitude=${params.latitude}&longitude=${params.longitude}`
  );
  return data;
}
//根据经纬度 获取商圈里的商家 params应该传一个对象里面包含经度和纬度

async function getInfo(id) {
  let { data } = await http.get(
    "http://elm.cangdu.org/shopping/restaurant/" + id
  );
  return data;
}
//在详情页获取商家详情
async function getMenu(id) {
  let { data } = await http.get(
    "https://elm.cangdu.org/shopping/v2/menu?restaurant_id=" + id
  );
  return data;
}
//在详情页获取菜单列表
export { getSearch, getList, getInfo, getMenu };
